<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".bs-navbar-collapse">
                <span class="sr-only">导航开关</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <php>if(C('WEB_SITE_LOGO')):</php>
                <a class="navbar-brand" href="__ROOT__/"><img class="logo" src="{$Think.config.WEB_SITE_LOGO|get_cover='path'}"></a>
            <php>else:</php>
                <a class="navbar-brand" href="__ROOT__/">{:C('WEB_SITE_TITLE')}</a>
            <php>endif;</php>
        </div>
        <div class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
            <ul class="nav navbar-nav">
                <think:nav name="nav">
                    <eq name="nav.pid" value="1">
                        <li>
                            <a href="{$nav|get_nav_url}" target="<eq name='nav.target' value='1'>_blank<else/>_self</eq>">
                                {$nav.title}
                            </a>
                        </li>
                    </eq>
                </think:nav>
            </ul>
            <form class="navbar-form navbar-left search hidden-sm " action="__ROOT__/Index/search.html" role="search">
                <div class="form-group">
                    <input type="text" class="form-control transition" name="key" value="{$_GET.key}" placeholder="搜索">
                </div>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <?php if($uid = is_login()): ?>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle main-nav" data-toggle="dropdown">
                            <img src="{$uid|get_user_info='avatar'|get_cover='path'}"/>
                            <neq name="unreadMessageCount" value="0"><span class="badge badge-red">{$unreadMessageCount}</span></neq>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="{:U('Tweet/space')}"><span class="glyphicon glyphicon-home"></span>我的空间</a></li>
                            <li><a href="{:U('User/profile')}"><span class="glyphicon glyphicon-user"></span>个人中心</a></li>
                            <li><a href="{:U('Article/mydocument')}"><span class="glyphicon glyphicon-list"></span>我的文档</a></li>
                            <li>
                                <a href="{:U('Message/index')}"><span class="glyphicon glyphicon-comment"></span>消息中心
                                    <neq name="unreadMessageCount" value="0"><span class="badge badge-red">{$unreadMessageCount}</span></neq>
                                </a>
                            </li>
                            <li><a href="{:U('Article/mybookmark')}"><span class="glyphicon glyphicon-star"></span>我的收藏</a></li>
                            <li><a href="{:U('Article/update')}"><span class="glyphicon glyphicon-edit"></span>我要投稿</a></li>
                            <li class="divider hidden-xs"></li>
                            <li><a href="{:U('User/logout')}" class="ajax-get"><span class="glyphicon glyphicon-off"></span>退出登录</a></li>
                        </ul>
                    </li>
                <?php else: ?>
                    <li class="login">
                        <a href="#" data-toggle="modal" data-target="#login-modal">登录</a>
                    </li>
                    <li class="login">
                        <a href="#" data-toggle="modal" data-target="#login-modal">注册</a>
                    </li>
                <?php endif; ?>
            </ul>
        </div>
    </div>
</nav>

<include file="User/loginmodal"/>

